﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
if sid="Null" then
Response.Redirect "/login.asp?sid="&sidd&"&url=/game/sangon/index.asp"
else

dim id,tuda
	id=Request.QueryString("id")
	if id="" then id=1
	if not isnumeric(id) then id=1
	id=clng(id)

select case v
case "0"
we0="<br/>"
hr="--------------<br/>"
%>
<card id="main" title="幸运三公"><p align="<%=qingtian.px%>">
<%
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
we1="</div>"
ziz="<div style=""background-color:#FF5226;font-size:16px;color:#E1E100"">"
%>
<title>幸运三公</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select
qingtian.info
sangong.tj
sangong.pd(id)
if Request.QueryString("act")=1 then
        tuda=0
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * from qingtian_fangd where pid="&id&""
	Rs.Open Sql,cn,1,1
        if rs.RecordCount<14 then tuda=1
	Rs.close
        set rs=nothing
        if tuda=1 then
	                Set Rs = Server.CreateObject("Adodb.Recordset")
			Sql = "select * from qingtian_fangd"
			Rs.Open Sql,cn,1,3
	rs.addnew
        rs("time")=now
	rs("pid")=id
	rs.update
	aid=rs("id")
	Rs.close
set rs=nothing
Response.Redirect "gamed.asp?pid="&id&"&id="&aid&"&sid="&sidd&""
end if
end if
%>
<%=ziz%>★多人对战★<%=we0%><%=we%>
<%if Request.QueryString("action")="" then%>
本游戏分4个对战区,每个对战区都设置了最小进入<%=qingtian.bi%>数,如果你的<%=qingtian.bi%>数不足,那么你是没法进入该房间的.<br/>请选择对战区:<br/>
<%
	                Set Rs = Server.CreateObject("Adodb.Recordset")
			Sql = "select [id],[name],[money] from qingtian_fangjian order by [money] asc"
			Rs.Open Sql,cn,1,1
			if not (rs.bof and rs.eof)  then
			For i=1 to rs.RecordCount
                        Response.Write(""&i&".<a href='fangd.asp?action=1&amp;id="&rs("id")&"&amp;sid=" & sidd & "'>对战区"&rs("id")&"("&rs("money")&")</a><br/>")
			Rs.MoveNext
			next
			end if
			Rs.close
                        set rs=nothing
%>
<%=we1%><%=sou%>
<a href="index.asp?sid=<%=sidd%>">幸运三公</a>.<a href="/game/index.asp?sid=<%=sidd%>">游戏大厅</a><%=we0%>
<%
else
%>小提示:<%=zi%>游戏过程中玩家不能中途退出<%=zi0%><%=we0%><%=sou%>
当前游戏在线人数<%=zi%><%=sangong.online%><%=zi0%><br/>
请选择任意一桌:<%=we0%><%=hr%><%=we%>
<%

dim sql,rs,i,strrt
	                Set Rs = Server.CreateObject("Adodb.Recordset")
			Sql = "select [id],[ton],[time] from qingtian_fangd where pid="&id&" order by [id] asc"
			Rs.Open Sql,cn,1,3
			if not (rs.bof and rs.eof)  then
			For i=1 to rs.RecordCount
                        if DATEDIFF("h", rs("time"), now())>24 and (sangong.moname(rs("id"))="" or sangong.moname(rs("id"))="暂无玩家") then
                        rs.delete
                        else
                        Response.Write("第"&i&"卓|玩家("&sangong.moname(rs("id"))&")<br/>状态:"&sangong.moton(rs("ton"),rs("id"),id)&"<br/>")
                        end if
			Rs.MoveNext
			next
                        else
                        Response.Write("暂无玩家,请新开一桌再进行游戏.<br/>")           
			end if
			Rs.close
			Sql = "select top 1 [id] from qingtian_fangd where pid="&id&" and ton=0 order by [id] asc"	
			Rs.Open Sql,cn,1,1
			if not (rs.bof and rs.eof)  then
                        strrt="gamed.asp?pid="&id&"&amp;id="&rs("id")&"&amp;sid="&sidd&""
                        else
                        strrt="fangd.asp?action=1&amp;id="&id&"&amp;act=1&amp;sid="&sidd&""                        
			end if
			Rs.close		
		        set rs=nothing
%>
<%=hr%>你的<%=sangong.tonn%><%=we0%><%=sou%>
<a href='fangd.asp?action=1&amp;id=<%=id%>&amp;act=1&amp;sid=<%=sidd%>'>新开一桌</a>.<a href='<%=strrt%>'>自动配对</a><br/>
<a href="fangd.asp?sid=<%=sidd%>">选择战区</a>.<a href="/game/sangon/index.asp?sid=<%=sidd%>">幸运三公</a><%=we0%>
<%
end if
end if
end function
%>